From: Florian Müllner Date: Mon, 31 Jan 2011 16:49:02 +0000 (-0500) Subject: Calendar: Fix UTC/local mixup X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~9160 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d9e778f501fa54bd3d886f4b984de0908a26235f;p=gnome-shell.git Calendar: Fix UTC/local mixup See https://bugzilla.gnome.org/show_bug.cgi?id=632109#c56 Signed-off-by: David Zeuthen --- diff --git a/src/shell-evolution-event-source.c b/src/shell-evolution-event-source.c index dd2aea91f..2982ddc4d 100644 --- a/src/shell-evolution-event-source.c +++ b/src/shell-evolution-event-source.c @@ -99,7 +99,7 @@ shell_evolution_event_source_request_range (ShellEvolutionEventSource *source, gint64 msec_begin, gint64 msec_end) { - GDateTime *middle; + GDateTime *middle_utc, *middle; /* The CalendarClient type is a convenience wrapper on top of * Evolution Data Server. It is based on the assumption that only @@ -112,7 +112,10 @@ shell_evolution_event_source_request_range (ShellEvolutionEventSource *source, * days before and after) it works out just fine. */ - middle = g_date_time_new_from_unix_utc ((msec_begin + msec_end) / 2 / 1000); + middle_utc = g_date_time_new_from_unix_utc ((msec_begin + msec_end) / 2 / 1000); + /* CalendarClient uses localtime rather than UTC */ + middle = g_date_time_to_local (middle_utc); + g_date_time_unref (middle_utc); g_date_time_get_ymd (middle, &source->req_year, &source->req_mon, NULL); g_date_time_unref (middle); calendar_client_select_month (source->client, source->req_mon - 1, source->req_year); @@ -152,15 +155,22 @@ shell_evolution_event_source_get_events (ShellEvolutionEventSource *source, { GList *result; GDateTime *cur_date; - GDateTime *begin_date; - GDateTime *end_date; + GDateTime *begin_date_utc, *begin_date; + GDateTime *end_date_utc, *end_date; g_return_val_if_fail (msec_begin <= msec_end, NULL); result = NULL; - begin_date = g_date_time_new_from_unix_utc (msec_begin / 1000); - end_date = g_date_time_new_from_unix_utc (msec_end / 1000); + begin_date_utc = g_date_time_new_from_unix_utc (msec_begin / 1000); + end_date_utc = g_date_time_new_from_unix_utc (msec_end / 1000); + + /* CalendarClient uses localtime rather than UTC */ + begin_date = g_date_time_to_local (begin_date_utc); + end_date = g_date_time_to_local (end_date_utc); + g_date_time_unref (begin_date_utc); + g_date_time_unref (end_date_utc); + cur_date = g_date_time_ref (begin_date); do {